#ifndef MYSPLASHSCREEN_H
#define MYSPLASHSCREEN_H

#define NUM_OF_ITEMS 6

#include "MyDefinitions.h"
#include "MyUniversal.h"
#include "MyGame.h"

/*! 
 *  \struct tradeItem
 *  \brief holds information about items that could be bought in the village
 *  \author Peter Kosa
 *  \version 1.52
 *  \date    2006-2008
 */
struct tradeItem {
  /*! text description */
	char * description;
	/*! price of the item */
	int price;
	/*! clips - either screen, or sheet */
	SDL_Rect *screen_clip, *sheet_clip;
	
	tradeItem(){}
	tradeItem(char* d , int p, SDL_Rect* scr, SDL_Rect* sh):description(d),price(p),screen_clip(scr), sheet_clip(sh){;};
	~tradeItem(){
		delete(screen_clip);
		delete(sheet_clip);
	}
};
/*! 
 *  \class MySplashScreen
 *  \brief screen that is visible after players completes his mission - village and goods to buy are here
 *  \author Peter Kosa
 *  \version 1.52
 *  \date    2006-2008
 */
class MySplashScreen{
public:
	MySplashScreen(MyGame* _parent);
	~MySplashScreen();

  /*! load images for items from hdd - popup img, bg img, items imgs */ 
	void load_imgs();
	/*! init everything needed */
	void init();
	/*! create popup message - depends on item selected and action performed as last */
	void create_popup(int selected, int option);
	/*! shopping finised - back to action! */
	bool finised();
	/*! display the splash screen on main screen (on scenery) */
	void displaySplashScreen(int);
	/*! handle click on [x,y], depending on the state of splash screen */
	bool process_click(int x, int y);
	/*! create form to be displayed on the screen */
	void prepare_form();
	/*! returns true if player has more gp than the item cost */
	bool player_can_afford(int);
	/*! player wants to buy an item */
	bool process_buy_clicked(int item_pos_in_action_manager);
private:
  /*! all possible items to buy */
	tradeItem* trade_items_array[NUM_OF_ITEMS];
	SDL_Surface* popupSheetBkp, *popupSheet, *money, *formSheet, *formSheetBkp, *itemSheet;
	MyGame * parent;
	int popup_visible, selected_item;
	int time_final, time_current;
};
#endif
